<extend name="Public/base" />
<block name="body">
	<style>
		a{
			cursor: pointer;
		}
	</style>
	<!-- 标题栏 -->
	<div class="main-title">
		<h2>订单管理/待发货订单</h2>
	</div>

	<!-- 高级搜索 -->
	<!--<div class="user-center">-->
		<!--<form action="admin.php?s=/Order/order.html" method="get">-->
			<!--<div class="search-form fr cf">-->
				<!--<div class="sleft">-->
					<!--<input type="text" name="mobile" class="search-input" value="{:I('condition')}" placeholder="请输入手机号">-->
				<!--</div>-->
			<!--</div>-->
			<!--<div class="search-form fr cf">-->
				<!--<div class="sleft">-->
					<!--<input type="text" name="order_no" class="search-input" value="{:I('condition')}" placeholder="请输入订单号">-->
				<!--</div>-->
			<!--</div>-->

			<!--<div class="search-form fr cf">-->
				<!--<div class="sleft">-->
					<!--<select name="type">-->
						<!--<option>选择产品分类</option>-->
						<!--<option val="1">抢购商品</option>-->
						<!--<option val="2">预约商品</option>-->
						<!--<option val="3">定制商品</option>-->
					<!--</select>-->
				<!--</div>-->
			<!--</div>-->
			<!--<div class="sous" style="margin-top: -3px;text-align: center">-->
				<!--<input type="submit" class="btn sch-btn" href="javascript:;" id="search" url="{:U('Order/order')}"><span>搜索</span></input>-->
			<!--</div>-->
		<!--</form>-->
	<!--</div>-->
	<!-- 数据列表 -->
	<div class="table-striped－main">
		<ul>
			<li><a class="table-striped－main-great" href="admin.php?s=/Order/order.html">全部</a></li>
			<li><a href="admin.php?s=/Order/order/status/2.html">待付款</a></li>
			<li><a href="admin.php?s=/Order/order/status/3.html" >待发货</a></li>
			<li><a href="admin.php?s=/Order/order/status/4.html">已发货</a></li>
			<li><a href="admin.php?s=/Order/order/status/5.html">待评价</a></li>
			<li><a href="admin.php?s=/Order/order/status/1.html">已完成</a></li>
			<!--<li><a href="admin.php?s=/Order/orderretrun.html">退货退款</a></li>-->
			<li><a href="admin.php?s=/Order/order/status/10.html">已取消</a></li>
		</ul>
	</div>


	<div class="table-striped">
		<notempty name="_list">
			<volist name="_list" id="vo"  key="n">
				<div class="item-box">
					<div class="order-top">
						<div class="col-sm-4"><label>订单单号：</label>{$vo.order_no}</div>
						<div class="col-sm-4"><label>用户ID：</label>{$vo.user_id}</div>
						<div class="col-sm-4"><label>下单时间：</label>{$vo.create_time}</div>
					</div>
					<div class="item-table">
						<table>
							<!-- 表头 -->
							<tr>
								<th>订单类型 </th>
								<th rowspan="2" class="no-padding">
									<table>
										<tr>
											<th>商品信息</th><th>商品编码</th><th>数量</th>
										</tr>
										<volist name="vo['goodlist']" id="good">
											<tr>
												<td>
													<div class="goods-box">
														<div class="image-box"><img src="{$good.img_path}"></div>
														<div class="goods-detail">
															<p>{$good.good_name}</p>
															<small>{$good.sku}</small>
														</div>
													</div>
												</td><td>{$good.code}</td><td>{$good.count}</td>
											</tr>
										</volist>
									</table>
								</th>
								<th>实付款</th>
								<th>收货信息</th>
								<th>状态</th>
								<th>操作</th>
							</tr>
							<tr>
								<td>{$vo.type_name}</td>
								<td>{$vo.amount}元</td>
								<td>{$vo.receiptinfo.province}{$vo.receiptinfo.city}{$vo.receiptinfo.area}{$vo.receiptinfo.address}<br>
									联系人：{$vo.receiptinfo.username}<br>
									联系人手机：{$vo.receiptinfo.phone}
								</td>
								<td><a>{$vo.status_name}</a></td>
								<td>
									{$vo.controller}
								</td>
							</tr>
						</table>
					</div>
					<div class="order-bottom">
						<p><label>平台备注：</label>已电话联系仓库验货，等待回复</p>
					</div>
				</div>
			</volist>
			<else/>
			<td colspan="6" class="text-center"> aOh! 暂时还没有内容! </td>
		</notempty>


		<div class="page">
			{$_page}
		</div>
		<div class="modal" style="display:none;">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-express">
						<div class="modal-header"><button type="button" class="close modal-close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
							<h4 class="modal-title" id="gridModalLabel">请为该订单填写物流单号</h4>
						</div>
						<div class="modal-body"><div class="form-item">
							<span class="item_name" style="margin-left: -48px">快递公司：</span>
							<select style="margin-left: 15px" class="selection_1 textbox_296" id="express_type">
								<option value="1">顺丰</option>
								<option value="2">深通</option>
								<option value="3">圆通</option>
								<option value="4">韵达</option>
								<option value="5">大丰</option>
								<option value="6">诚信</option>
							</select>
						</div>
						<div class="form-item">
								<span class="item_name" style="margin-left: -48px">快递单号：</span>
								<input class="textbox_296 " placeholder="快递单号..." type="text" style="margin-left: 15px" id="express_code" />
						</div>
						<div class="modal-footer">
								<button type="button" class="btn btn-return modal-close" data-dismiss="modal" aria-label="Close">取消</button>
								<button type="button" class="btn btn-primary submit-btn-express">确定</button>
								<input value="" type="hidden" id="invest_code">
						</div>
					</div>

				</div>
			</div>
			</div>
		</div>
	</div>
</block>

<block name="script">
	<script type="text/javascript" charset="utf-8">
		//搜索功能
		$("#search").click(function(){
			var url = $(this).attr('url');
			var query  = $('.search-form').find('input').serialize();
			query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
			query = query.replace(/^&/g,'');
			if( url.indexOf('?')>0 ){
				url += '&' + query;
			}else{
				url += '?' + query;
			}
			window.location.href = url;
		});
		//回车搜索
		$(".search-input").keyup(function(e){
			if(e.keyCode === 13){
				$("#search").click();
				return false;
			}
		});
		//导航高亮
		highlight_subnav('{:U('Order/order')}');

		$(".open-express").click(function(){
			var id = $(this).attr("code");
			$("#invest_code").val(id);
			$(".modal").show();
		})
		$('.submit-btn-express').on('click', function(){
			$(".modal").hide();
			var invest_id = $("#invest_code").val();
			var express_code = $("#express_code").val();
			var express_type = $("#express_type").val();
			$.post(
					'admin.php?s=/Order/changeexpress.html',
					{
						id:invest_id,express_code:express_code,express_type:express_type
					},
					function(responed){
						alert("新增成功");
						location.reload();
					}
			);
			return false;
		});
		$(' .modal-close').on('click', function(){
			$(".modal").hide();
		});
		$(function(){
			$('body').on('click', '.open-html', function(event){
				var id = $(this).attr("code");
				event.stopPropagation();
				var url = $(this).attr('href');
				if( !url )      return  false;
				var tips =  '评论信息',
						button = $(this).hasClass('open-delivery') ? true : false;
				load_html({
					url: url,
					title: tips,
					button: button
				});
				return false;

			});
		});
		$(".cacelorder").click(function(){
			var id = $(this).attr("code");
			if(confirm("确定取消订单吗")){
				$.post(
						'admin.php?s=/Order/cancelorder.html',
						{
							data: "",id:id
						},
						function(responed){
							alert("取消成功");
							location.reload();
						}
				);
			}
		})



	</script>
	<script type="text/javascript" charset="utf-8">
		onload = function ()
		{
			setInterval (function ()
			{
				var date = new Date ();
//				txt.value = date.toLocaleDateString();
			});

		}

	</script>
</block>